"use strict";
cc._RF.push(module, '3da86EmJ/RMOY4/eC5/xWyS', 'pausePanel');
// Script/pausePanel.ts

"use strict";
/**
 * 暂停界面
 */
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gamePrefabMgr_1 = require("./SdkTools/gamePrefabMgr");
var gameShareAdsVideo_1 = require("./SdkTools/gameShareAdsVideo");
var gameStorage_1 = require("./SdkTools/gameStorage");
var PlayData_1 = require("./SdkTools/PlayData");
var storage_1 = require("./SdkTools/storage");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var pausePanel = /** @class */ (function (_super) {
    __extends(pausePanel, _super);
    function pausePanel() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.zhendong = null;
        _this.yinyue = null;
        _this.sound = null;
        return _this;
    }
    // LIFE-CYCLE CALLBACKS:
    pausePanel.prototype.onLoad = function () {
        gameShareAdsVideo_1.default.Instance.chaPingAds_Show();
        gameShareAdsVideo_1.default.Instance.bannerAds_Show();
        this.zhendong.active = !(gameStorage_1.default.getzhendong() == 1);
        this.yinyue.active = gameStorage_1.default.getMusic() == 1;
        this.sound.active = gameStorage_1.default.getSound() == 1;
        PlayData_1.default.Instance.ispause = !0;
    };
    pausePanel.prototype.start = function () {
    };
    pausePanel.prototype.onDisable = function () {
        PlayData_1.default.Instance.ispause = !1;
    };
    // update (dt) {}
    pausePanel.prototype.close = function () {
        gameShareAdsVideo_1.default.Instance.bannerAds_Hide();
        this.node.removeFromParent(true);
    };
    pausePanel.prototype.replay = function () {
        gameShareAdsVideo_1.default.Instance.bannerAds_Hide();
        if (storage_1.default.Instance.getEnergy() <= 0) {
            //TipsManager.Instance.createTips('体力不足')
            var newnode = cc.instantiate(gamePrefabMgr_1.default.Instance.uiPre[gamePrefabMgr_1.uiPreName.addEngry]);
            newnode.parent = cc.director.getScene();
            return;
        }
        storage_1.default.Instance.setEnergy(storage_1.default.Instance.getEnergy() - 1);
        cc.director.emit('addengry');
        gameShareAdsVideo_1.default.Instance.recording_Video_End();
        switch (PlayData_1.default.Instance.gameType) {
            case PlayData_1.GameType.finddifference_zhaobutong:
                cc.director.loadScene('GameScene');
                break;
        }
    };
    pausePanel.prototype.zhendongclick = function () {
        this.zhendong.active = !this.zhendong.active;
        if (this.zhendong.active) {
            gameStorage_1.default.setzhendong(0);
        }
        else {
            gameStorage_1.default.setzhendong(1);
        }
    };
    pausePanel.prototype.yinyueclick = function () {
        this.yinyue.active = !this.yinyue.active;
        if (this.yinyue.active) {
            gameStorage_1.default.setMusic(1);
            cc.audioEngine.stopAll();
        }
        else {
            gameStorage_1.default.setMusic(0);
            switch (PlayData_1.default.Instance.gameType) {
                case PlayData_1.GameType.finddifference_zhaobutong:
                    cc.director.emit('game_bg1');
                    break;
            }
        }
    };
    pausePanel.prototype.soundClick = function () {
        this.sound.active = !this.sound.active;
        if (this.sound.active) {
            gameStorage_1.default.setSound(1);
        }
        else {
            gameStorage_1.default.setSound(0);
        }
    };
    pausePanel.prototype.backToStartScene = function () {
        gameShareAdsVideo_1.default.Instance.recording_Video_End();
        gameShareAdsVideo_1.default.Instance.bannerAds_Hide();
        cc.director.loadScene('StartScene');
    };
    __decorate([
        property(cc.Node)
    ], pausePanel.prototype, "zhendong", void 0);
    __decorate([
        property(cc.Node)
    ], pausePanel.prototype, "yinyue", void 0);
    __decorate([
        property(cc.Node)
    ], pausePanel.prototype, "sound", void 0);
    pausePanel = __decorate([
        ccclass
    ], pausePanel);
    return pausePanel;
}(cc.Component));
exports.default = pausePanel;

cc._RF.pop();